package com.hut.oa.model.bean;

import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.springframework.format.annotation.DateTimeFormat;
/**
 * 部门表
 * @author 潘寻毅
 *
 */
@Entity
@Table(name = "dept_")
public class Dept {
	
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name="d_id")
	private Long id;//部门id
	
	@Column(name="d_name",nullable=false)
	private String name;//部门名称
	
	@Column(name="d_tel",nullable=false)
	private String tel;//部门电话
	
	@Column(name="d_email")
	private String email;//部门邮件
	
	@Column(name="d_fax")
	private String fax;//部门传真
	
	@Column(name="d_grade",nullable=false)
	private Integer grade;//部门层级
	
	@Temporal(TemporalType.TIME)
	@DateTimeFormat(pattern="HH:mm:ss")
	@Column(name="d_begin_time",nullable=false)
	private Date beginTime;//部门上班时间
	
	@Temporal(TemporalType.TIME)
	@DateTimeFormat(pattern="HH:mm:ss")
	@Column(name="d_end_time",nullable=false)
	private Date endTime;//部门下班时间
	
	@Column(name="d_check_day",nullable=false)
	private Integer checkDay=22;//规定打卡次数
	
	@OneToMany(cascade=CascadeType.ALL,mappedBy="dept")
	private List<DeptOffice> deptOffices;//所有职位

	public Dept() {}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getTel() {
		return tel;
	}

	public void setTel(String tel) {
		this.tel = tel;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getFax() {
		return fax;
	}

	public void setFax(String fax) {
		this.fax = fax;
	}

	public Integer getGrade() {
		return grade;
	}

	public void setGrade(Integer grade) {
		this.grade = grade;
	}

	public Date getBeginTime() {
		return beginTime;
	}

	public void setBeginTime(Date beginTime) {
		this.beginTime = beginTime;
	}

	public Date getEndTime() {
		return endTime;
	}

	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}

	public Integer getCheckDay() {
		return checkDay;
	}

	public void setCheckDay(Integer checkDay) {
		this.checkDay = checkDay;
	}

	@Override
	public String toString() {
		return "Dept [id=" + id + ", name=" + name + ", tel=" + tel + ", email=" + email + ", fax=" + fax + ", grade="
				+ grade + ", beginTime=" + beginTime + ", endTime=" + endTime + ", checkDay=" + checkDay + "]";
	}
	
}
